# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-apache-log-parser
pkgname=('python2-apache-log-parser' 'python-apache-log-parser')
_pkgname='apache-log-parser'
pkgver=1.7.0
pkgrel=9
pkgdesc='Parse lines from an apache log file.'
arch=('any')
url='https://pypi.org/project/apache-log-parser/#files'
license=('GPL3')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('08d9e61ef035e1bcfb0a85704385c4f3d1575b0a1e773bef443b6d1071ada211e86193f854d6e3edf9ad7c3da1e544f92331e513081d1254af5d3b8a0bac9e3e')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-apache-log-parser() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-apache-log-parser() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

